package com.wnhz.wnmap.smovie.movie.service.impl;

import com.wnhz.wnmap.domain.entity.Movie;
import com.wnhz.wnmap.smovie.movie.dao.IMovieDao;
import com.wnhz.wnmap.smovie.movie.service.IMovieService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class MovieServiceImpl implements IMovieService {

    @Autowired
    private IMovieDao is;


    @Override
    public List<Movie> findByNameLike(String name) {
        List<Movie> list = is.findByNameLike("%" + name + "%");
        return list;
    }
    //分页
    @Override
    public Page findByMovie(int currentPage, int size) {
        Pageable pageable = PageRequest.of(currentPage,size);
        return is.findAll(pageable);
    }
}
